package demo7;
public class InterfaceArr {
    public static void main(String[] args) {
        usb[] usbs=new usb[2];
        usbs[0]=new camera();
        usbs[1]=new phone();
        for(int i=0;i<usbs.length;i++){
            usbs[i].work();//动态绑定
            if(usbs[i] instanceof phone){
                ((phone)usbs[i]).call();
            }
        }
    }
}
interface usb{
    void work();
}
class camera implements usb{
    @Override
    public void work() {
        System.out.println("相机正在工作中......");
    }
}
class phone implements usb{
    public void call(){
        System.out.println("手机可以拨打电话......");
    }
    @Override
    public void work() {
        System.out.println("手机正在工作中......");
    }
}
